#!/usr/bin/env python
# encoding: utf-8

"""
@version: python3.7
@Author  : huangyi
@contact:  hy.dazui@qq.com
@Time    : 2020/1/12 23:12
@Describe: add Describe here
"""
from abc import ABC, abstractmethod
from enum import Enum


class TokenType(Enum):
    NUMBER = 1  # 数字
    OP = 2  # 运算符
    LEFT_BRACKET = 3  # 左括号
    RIGHT_BRACKET = 4  # 右括号
    POINT = 5  # 小数
    FUNC = 6  # 方法
    COMMA = 7  # 逗号
    STRING = 8  # 字符串
    VAR = 9  # 变量
    END = 100


class Token(ABC):

    def __init__(self, data):
        self.data = data

    @abstractmethod
    def get_type(self):
        pass

    def get_data(self):
        return self.data

    def __str__(self):
        return self.data

    def __repr__(self):
        return self.data


class OpToken(Token):

    def get_type(self):
        return TokenType.OP


class NumberToken(Token):

    def get_type(self):
        return TokenType.NUMBER


class PointToken(Token):

    def get_type(self):
        return TokenType.POINT


class LeftBracket(Token):

    def get_type(self):
        return TokenType.LEFT_BRACKET


class RightBracket(Token):

    def get_type(self):
        return TokenType.RIGHT_BRACKET


class FuncToken(Token):

    def get_type(self):
        return TokenType.FUNC


class CommaToken(Token):

    def get_type(self):
        return TokenType.COMMA


class StringToken(Token):

    def get_type(self):
        return TokenType.STRING


class VarToken(Token):

    def get_type(self):
        return TokenType.VAR


class EndToken(Token):

    def __init__(self):
        super().__init__(None)

    def get_type(self):
        return TokenType.END

    def __repr__(self):
        return "<end>"

    def __str__(self):
        return "<end>"
